package com.kaizzi.data.jdl.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kaizzi.data.common.been.TempBeen;
import com.kaizzi.data.jdl.entity.TeamMember;
import com.kaizzi.data.jdl.mapper.TeamMemberMapper;
import com.kaizzi.data.jdl.service.JdlNumService;
import com.kaizzi.data.jdl.service.TeamMemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Kzen
 * @Description description
 * @date 2020/9/11
 */
@Slf4j
@Service
public class TeamMemberServiceImpl extends ServiceImpl<TeamMemberMapper, TeamMember> implements TeamMemberService {

    @Resource
    private TeamMemberMapper teamMemberMapper;
    @Resource
    private JdlNumService jdlNumService;

    @Override
    @DS("jdl_view")
    public long getTeamUser(String startDate, String endDate, String leaderType) {
        Long teamUser = teamMemberMapper.getTeamUser(startDate, endDate, leaderType);
        return jdlNumService.transNum(teamUser);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getTeamGender(String startDate, String endDate) {
        return teamMemberMapper.getTeamGender(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getTeamAge(String startDate, String endDate) {
        return teamMemberMapper.getTeamAge(startDate,endDate);
    }
}
